home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
6_5.lha
/
6_5
/
6_5srep.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
664b
|
47 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ define the class to manage the
/ actual character string
lass srep
friend class string;
char *s;
int size;
int refcnt;
srep()
{
refcnt = 1;
s = new char[size = 1];
s[0] = 0;
}
srep(int sz)
{
refcnt = 1;
s = new char[size = sz];
s[0] = 0;
}
srep(char *x)
{
refcnt = 1;
s = new char[size = strlen(x) + 1];
strcpy(s, x);
}
srep& operator=(char *x)
{
delete s;
refcnt = 1;
s = new char[size = strlen(x) + 1];
strcpy(s, x);
return *this;
}
~srep()
{ delete s; }
;